package com.zyz.rabbitextensionsdemo.listener;

import com.zyz.rabbitextensionsdemo.constants.Constants;
import org.springframework.amqp.core.Message;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

import java.util.Date;

@Component
public class DelayListener {
    @RabbitListener(queues = Constants.DELAY_QUEUE)
    public void handMessage(Message message) {
        long deliveryTag = message.getMessageProperties().getDeliveryTag();
        System.out.printf("%tc ["+Constants.DELAY_QUEUE+"] 接收到消息：%s, deliveryTag： %d \n",new Date(),
                new String(message.getBody()), deliveryTag);

    }
}
